/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package submarines;

import SubmarinesBindings.Board;
import SubmarinesBindings.Boat;
import java.util.List;
import javax.xml.bind.JAXBException;
import submarines.notices.NotficationManager;
import submarines.thread.EaPlayerTurn;

/**
 *
 * @author elad
 */
public class OnlineEaPlayer extends EaPlayer implements Runnable {
    EaPlayerTurn myTurn;
    PlayerManager p;
    //NotficationManager n;

    public OnlineEaPlayer(PlayerManager pm) {
        super();
    }

    public OnlineEaPlayer(String userName, PlayerManager pm) {
        super(userName);
        p = pm;
    }

    public OnlineEaPlayer(String userName, int userScore, EaPlayerTurn t, PlayerManager pm) {
        super(userName, userScore);
        p = pm;
    }

    public OnlineEaPlayer(String name, List<Boat> xmlBoats, Board b, PlayerManager pm) throws JAXBException {
        super(name, xmlBoats, b);
        p = pm;
    }
    
    public void setTurn (EaPlayerTurn t) {
        myTurn = t;
    }
    
    @Override
    public void run() {
        while ((!isDead()) && (p.numPlayersLeft() > 1)) {
            Player op = p.get(1);
            myTurn.playTurn(op);
        }
    }
}
